/**
 * 
 */
package de.tsvberssel.domain;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;

/**
 * @author starbuck
 *
 */
public class Application {

	private Application(){
		super();
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			final GameFile gameFile = new GameFile();
			
			final Question question = new Question();
			question.setLevel(1);
			question.setText("Was macht 2x2?");
			
			final Answer answer1 = new Answer();
			answer1.setText("1");
			question.getAnswers().add(answer1);
			
			final Answer answer2 = new Answer();
			answer2.setText("2");
			question.getAnswers().add(answer2);
			
			final Answer answer3 = new Answer();
			answer3.setText("3");
			question.getAnswers().add(answer3);
			
			final Answer answer4 = new Answer();
			answer4.setText("4");
			answer4.setRigth(true);
			question.getAnswers().add(answer4);
			
			gameFile.getQuestions().add(question);
			
			final JAXBContext context = JAXBContext.newInstance(GameFile.class);
			final Marshaller marshaller = context.createMarshaller();
			marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
			marshaller.marshal(gameFile, System.out);
			
		} catch (JAXBException e) {
			e.printStackTrace();
		}
	}

}
